<%-- 
    Document   : FormChattingKonsultan
    Created on : 03 Des 12, 11:47:17
    Author     : ASUS 1215P
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList"%>
<%@page import="aktor.ChattingKonsultan"%>
<!DOCTYPE html>
                    <%
                        //String id_konsultan = "0002";
                        String id_konsultan = session.getAttribute("password").toString();
                    %>
<html xmlns="">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Klinik Gizi Online</title>
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <link href="apuppy_style.css" rel="stylesheet" type="text/css" />
        <script language="javascript" type="text/javascript">
            function clearText(field)
            {
                if (field.defaultValue == field.value) field.value = '';
                else if (field.value == '') field.value = field.defaultValue;
            }
        </script>
        <script>
                                function isiID(id){
                
                                    document.getElementById('IdPasien').value = id;
                                }
                            </script>
    </head>
    <body>
        <div id="templatemo_header_wrapper">

            <div id="templatemo_header">

                <div id="site_title">
                    <h1><a href="index.jsp" target="_parent ">
                            Apuppy
                        </a></h1>
                </div>

                <div id="templatemo_menu">
                    <ul>
                        <li><a href="indexKonsultan.jsp" class="current">Home</a></li>
                        <li><a href="profile.jsp" target="_parent">profile</a></li>
                        <li><a href="formPendaftaran.jsp" target="_parent">pendaftaran</a></li>
                    </ul>    	
                </div> <!-- end of templatemo_menu -->



                <div class="cleaner"></div>
            </div> <!-- end of templatemo_header -->

        </div> 
        <!-- end of templatemo_header_wrapper -->

        <div id="templatemo_content_wrapper">

            <div id="">

                <div class="content_section">
                            
                        </head>
                        <center>
                                <h1>Selamat Datang di Halaman Chatting</h1>
                                <table border="1">
                                    <tbody>
                                        <tr>
                                            <td width="300" height="400" style="vertical-align: top;">
                                                <table bgcolor="LimeGreen"><tbody>
                                                        <tr>
                                                            <td width="300" height="50" style="vertical-align: top;"><b><U>Inbox</u></b></td></tr>
                                                                        <%
                                                                            ArrayList<ChattingKonsultan> inbox = new ChattingKonsultan().getInbox(id_konsultan);
                                                                            for (int i = 0; i < inbox.size(); i++) {
                                                                                if (i % 2 == 0) {
                                                                        %>

                                                        <tr>
                                                            <td width="300" height="50" bgcolor="bisque"><%= inbox.get(i).getPesan()%> <br>
                                                                <button onclick="isiID('<%= inbox.get(i).getId_pengirim()%>')">balas</button></td></tr>
                                                                <%} else {%>
                                                        <tr>
                                                            <td width="300" height="50" bgcolor="lightgray"><%= inbox.get(i).getPesan()%><br>
                                                                <button onclick="isiID('<%= inbox.get(i).getId_pengirim()%>')">balas</button> </td></tr>

                                                        <%
                                                                }
                                                            }
                                                        %>
                                                    </tbody>
                                                </table>
                                            </td>
                                            <td width="300" height="400" style="vertical-align: top;">
                                                <table bgcolor="white"><tbody>
                                                        <tr>
                                                            <td width="300" height="50" style="vertical-align: top;"><b><U>Outbox</u></b></td></tr>
                                                                        <%
                                                                            ArrayList<String> outbox = new ChattingKonsultan().getOutbox(id_konsultan);
                                                                            for (int i = 0; i < outbox.size(); i++) {
                                                                                if (i % 2 == 0) {
                                                                        %>

                                                        <tr>
                                                            <td width="300" height="50" bgcolor="bisque"><%= outbox.get(i)%> </td></tr>
                                                            <%} else {%>
                                                        <tr>
                                                            <td width="300" height="50" bgcolor="lightgray"><%= outbox.get(i)%> </td></tr>

                                                        <%
                                                                }
                                                            }
                                                        %>
                                                    </tbody>
                                                </table>
                                            </td>
                                            <td bgcolor="PaleGreen" width="500" style="vertical-align: top;">
                                                <form action="chatKonsultan">
                                                    <table>
                                                        <tbody>
                                                            <tr>
                                                                <td>
                                                                    <b>Id Konsultan :</b>
                                                                    <input name="idKonsultan" id="IdKonsultan" value="<%= id_konsultan%>" type="text" size="40" class="i" autocomplete="off">
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    <b>Id Pasien    :</b>
                                                                    <input name="idPasien" id="IdPasien" value="<%= request.getParameter("pasien")%>" type="text" size="40" class="i" autocomplete="off">
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    <b>Pesan </b>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    <textarea name="pesan" title="Message Body" rows="15" cols="50" wrap="virtual" class="mi">
                                                                    </textarea>
                                                                <td>
                                                            </tr>
                                                            <tr> 
                                                                <td> <input type="submit" name="send" value="Kirim">&nbsp;
                                                                    <input type="submit" value="back" name="back" formaction="indexKonsultan.jsp" /> &nbsp;
                                                                </td>
                                                            </tr>
                                                    </table>
                                                </form>
                                </table>
                        </center>
                                                
                                                
                                                </div>




                                                </div> 




                                                </div> <!-- end of content -->




                                                <div id="templatemo_footer">

                                                    <ul class="footer_menu">

                                                    </ul>

                                                    Copyright Â© 2048 <a href="#">Apuppy 2010</a> | 
                                                    Designed by <a href="" target="_parent">Apuppy Klinik Gizi Online</a> | 
                                                    <a href="https://www.usd.ac.id">www.usd.ac.id</a>
                                                </div> <!-- end of templatemo_footer -->
                                                </body>
                                                </html>
                                    